﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class D03_Time1 : MonoBehaviour
{
    //从游戏开始到现在的总时间
    private void Update1()
    {
        print(Time.time);
    }

    /*每隔一秒生成一个方块*/

    private float nextTime = 0; //下次生成的时间
    public float interva = 1;//间隔时间
    private void Update()
    {
        if (Time.time > nextTime)
        {
            print("生成");
            GameObject.CreatePrimitive(PrimitiveType.Cube).AddComponent<Rigidbody>();
            nextTime += interva;
        }
    }
}